package com.xy;

import java.util.Scanner;

/**
 * @author 谢阳
 * @version 1.8.0_131
 * @date 2022/6/18 20:40
 * @description
 */
public class Client {
    public static void main(String[] args) {
        // 游戏开始
        Originator originator = new Originator();

        // 游戏存档
        Caretaker caretaker = new Caretaker();

        // 游戏进度
        originator.setState("剩余100点血");
        System.out.println("++通过第一关,前往第二关++");
        caretaker.addState(originator.save());
        originator.setState("剩余75点血");
        System.out.println("++通过第二关,前往第三关++");
        caretaker.addState(originator.save());
        originator.setState("战败~~");
        caretaker.addState(originator.save());
        System.out.println("++请选择恢复存档店++");
        System.out.println("++1.第二关开始100点血 2.第三关开始75点血++");
        System.out.print("请选择:");
        Scanner scanner = new Scanner(System.in);
        switch (scanner.next()) {
            case "1":
                System.out.println("恢复第二关开始存档点");
                originator.resume(caretaker.getState(0));
                break;
            case "2":
                System.out.println("恢复第二关开始存档点");
                originator.resume(caretaker.getState(1));
                break;
            default:
                System.out.println("退出~");
                break;
        }
    }
}
